package com.fastloan.core.apiauth;

import com.fastloan.core.apiauth.base.anno.encrypt.EncryptMode;
import com.fastloan.core.apiauth.base.anno.sign.SignMode;
import com.fastloan.core.apiauth.base.endecrypt.impl.AesCBC;
import com.fastloan.core.apiauth.base.endecrypt.impl.AesECB;

import static com.fastloan.core.apiauth.base.enums.EncryptModeEnum.MD5;

/**
 * @author yanwe
 * createTime 2018-01-2018/1/3 9:40
 */
@SignMode(encryptMode = MD5)
public class TestBean {

    private String agent_no;

    @EncryptMode(mode = {AesCBC.class, AesECB.class})
    private String name;

    @EncryptMode(mode = {AesCBC.class},source = "name",sourceEncryptIndex = {1,0})
    private String id_no;

    private String sex;

    public String getAgent_no() {
        return agent_no;
    }

    public void setAgent_no(String agent_no) {
        this.agent_no = agent_no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId_no() {
        return id_no;
    }

    public void setId_no(String id_no) {
        this.id_no = id_no;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TestBean testBean = (TestBean) o;

        if (name != null ? !name.equals(testBean.name) : testBean.name != null) return false;
        if (id_no != null ? !id_no.equals(testBean.id_no) : testBean.id_no != null) return false;
        return sex != null ? sex.equals(testBean.sex) : testBean.sex == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (id_no != null ? id_no.hashCode() : 0);
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        return result;
    }
}
